/*
 * @Description: 全屏查看大图
 * @Version: V1.0.0
 * @Author: 黄鑫
 * @Date: 2025-05-07
 * @LastEditors: 黄鑫
 * @LastEditTime: 2025-05-08
 * @FilePath: hx_image_preview_page.dart
 * @Remarks: 
 */

import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';

class HxImagePreviewPage extends StatelessWidget {
  final String imageUrl;
  const HxImagePreviewPage(this.imageUrl, {super.key});

  @override
  Widget build(BuildContext context) {
    return ExtendedImageSlidePage(
      slideAxis: SlideAxis.both,
      slideType: SlideType.onlyImage,
      child: SizedBox(
        width: double.infinity,
        height: double.infinity,
        child: ExtendedImage.network(
          imageUrl,
          fit: BoxFit.contain,
          enableSlideOutPage: true,
          mode: ExtendedImageMode.gesture,
          heroBuilderForSlidingPage: (widget) {
            return Hero(tag: imageUrl, child: widget);
          },
          initGestureConfigHandler: (_) => GestureConfig(
            minScale: 1.0,
            maxScale: 4.0,
            animationMinScale: 0.8,
            animationMaxScale: 4.5,
            speed: 1.0,
            inertialSpeed: 100.0,
            initialScale: 1.0,
            inPageView: false,
          ),
        ),
      ),
    );
  }
}
